package java_0217;

import java.util.ArrayDeque;
import java.util.Deque;

public class Dequetest {
    public static void main(String[] args) {
        //基于数组实现的双端队列
        Deque<Integer> deque=new ArrayDeque<>();
        //尾插
        deque.addLast(1);
        deque.addLast(3);
        deque.addLast(5);
        //尾插尾删或者头插头删就是栈
//        while(!deque.isEmpty()){//尾删
//            System.out.println(deque.pollLast());
//        }
        //头插尾删或者尾插头删就是队列
        while(!deque.isEmpty()){
            System.out.println(deque.pollFirst());
        }
    }
}
